package cn.nlsde.service.impl;

import cn.nlsde.dao.CategoryMapper;
import cn.nlsde.entity.Category;
import cn.nlsde.service.CategoryService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by zwj on 2016/10/6.
 */

@Service
public class CategoryServiceImpl implements CategoryService {


    public final Logger logger = LoggerFactory.getLogger(CategoryServiceImpl.class);

    @Autowired
    CategoryMapper categoryMapper;

    @Override
    public int save(Category obj) {
        return categoryMapper.insert(obj);
    }

    @Override
    public int delete(Category obj) {
        return categoryMapper.deleteByPrimaryKey(obj.getId());
    }

    @Override
    public int update(Category obj) {
        return 0;
    }

    @Override
    public Category selectById(Integer id) {
        return categoryMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Category> selectAll() {
        return categoryMapper.selectAll();
    }

    @Override
    public int deleteById(Integer id) {
        return categoryMapper.deleteByPrimaryKey(id);
    }




}
